package com.teamone.etl.taskmanager.entity;

import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.extension.activerecord.Model;
import com.fasterxml.jackson.annotation.JsonFormat;
import java.io.Serializable;
import java.util.Date;
import java.util.UUID;

/**
 任务结果输出表(EtlTaskOutputInfo)表实体类

 @author makejava
 @since 2021-01-09 08:46:52 */
@SuppressWarnings("serial")
public class EtlTaskOutputInfo extends Model<EtlTaskOutputInfo> {
    /**
     id
     */
    @TableId(type = IdType.INPUT)
    private String id;
    /**
     节点ID
     */
    private String nodeId;
    /**
     任务ID
     */
    private String taskId;
    /**
     输入字段
     */
    private String inputField;
    /**
     输出表
     */
    private String outputTable;
    /**
     输入表字段
     */
    private String outputTableField;
    /**
     创建人
     */
    private String createBy;
    /**
     创建时间
     */
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
    private Date createTime;
    /**
     更新人
     */
    private String updateBy;
    /**
     更新时间
     */
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
    private Date updateTime;

    public EtlTaskOutputInfo(JSONObject node, Date now) {
        this.id= UUID.randomUUID().toString();
        this.nodeId=node.getString("id");
        JSONObject nodeData = node.getJSONObject("data");
        this.taskId= nodeData.getString("taskId");
        this.inputField=nodeData.getString("fromField");
        this.outputTable=nodeData.getString("tableName");
        this.outputTableField=nodeData.getString("toField");
        this.createTime=this.updateTime=now;
    }


    public String getId () {
        return id;
    }

    public void setId (String id) {
        this.id = id;
    }

    public String getNodeId () {
        return nodeId;
    }

    public void setNodeId (String nodeId) {
        this.nodeId = nodeId;
    }

    public String getTaskId () {
        return taskId;
    }

    public void setTaskId (String taskId) {
        this.taskId = taskId;
    }

    public String getInputField () {
        return inputField;
    }

    public void setInputField (String inputField) {
        this.inputField = inputField;
    }

    public String getOutputTable () {
        return outputTable;
    }

    public void setOutputTable (String outputTable) {
        this.outputTable = outputTable;
    }

    public String getOutputTableField () {
        return outputTableField;
    }

    public void setOutputTableField (String outputTableField) {
        this.outputTableField = outputTableField;
    }

    public String getCreateBy () {
        return createBy;
    }

    public void setCreateBy (String createBy) {
        this.createBy = createBy;
    }

    public Date getCreateTime () {
        return createTime;
    }

    public void setCreateTime (Date createTime) {
        this.createTime = createTime;
    }

    public String getUpdateBy () {
        return updateBy;
    }

    public void setUpdateBy (String updateBy) {
        this.updateBy = updateBy;
    }

    public Date getUpdateTime () {
        return updateTime;
    }

    public void setUpdateTime (Date updateTime) {
        this.updateTime = updateTime;
    }

    /**
     获取主键值

     @return 主键值
     */
    @Override
    protected Serializable pkVal () {
        return this.id;
    }
}